using System;
using System.Collections.Generic;

namespace Terra.Core.Common.Exceptions;

/// <summary>
/// 验证异常
/// </summary>
public class ValidationException : BaseException
{
    /// <summary>
    /// 验证错误信息
    /// </summary>
    public IDictionary<string, string[]> Errors { get; }

    public ValidationException(string message)
        : base(message)
    {
        Errors = new Dictionary<string, string[]>();
    }

    public ValidationException(string message, Exception innerException)
        : base(message, innerException)
    {
        Errors = new Dictionary<string, string[]>();
    }

    public ValidationException(string message, string code)
        : base(message)
    {
        Code = code;
        Errors = new Dictionary<string, string[]>();
    }

    public ValidationException(IDictionary<string, string[]> errors)
        : base("数据验证失败")
    {
        Errors = errors;
    }

    public ValidationException(string message, IDictionary<string, string[]> errors)
        : base(message)
    {
        Errors = errors;
    }
}